import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-admin-comp',
  templateUrl: './admin-comp.component.html',
  styleUrls: ['./admin-comp.component.scss']
})
export class AdminCompComponent implements OnInit {
  private newsLists: Array<NewsList>;
  newsDate: any = new Date();
  nwTitle: string = '';
  nwAvatar: string = '';
  nwDesc: string = '';

  onClick() {
    console.log(this.nwTitle);
    console.log(this.nwAvatar);
    console.log(this.nwDesc);
    this.nwTitle = '';
    this.nwAvatar = '';
    this.nwDesc = '';
  }

  constructor() {}

  ngOnInit() {
    this.newsLists = [
      new NewsList(1, '标题１', 'liufu', '内容１'),
      new NewsList(2, '标题2', 'liufu', '内容2'),
      new NewsList(3, '标题3', 'liufu', '内容3'),
      new NewsList(4, '标题4', 'liufu', '内容4'),
      new NewsList(5, '标题5', 'liufu', '内容5'),
      new NewsList(6, '标题6', 'liufu', '内容6')
    ];
  }
}

export class NewsList {
  constructor(
    public id: number,
    public title: string,
    public avatar: string,
    public desc: string
  ) {}
}
